<!--部门结算申请明细-->
<template>
  <div>
    <f-search-form ref='search' :more='true' @searchHandler='searchHandler' 
                   @exportHandler='exportHandler'
                   :show-export-btn='true'
                   :exportUrl='api.hyOrderDetailsReturn.exportTemplate'>
      <f-search-form-item label='订单编号' name='orderNo' />
      <f-search-form-item label='业务员' name='saleManName' />
      <f-search-form-item label='单位名称' name='customName' />
      <f-search-form-item label='部门' name='deptId' type='select' :data='api.hyorder.listByCompanyId' :params='queryParam' value-key='deptId' label-key='deptName' slot='advanced' />
      <f-search-form-item label='发货日期' type='range' name='beginDate' slot='advanced' />
    </f-search-form>
    <f-table ref='table'
             rowKey='orderDetailsReturnId'
             :showSetting='false'
             setting-key='settleTab1'
             :tableColumns='columns'
             :scroll='{x:true}'
             :showMultipleBtn='false'
             :showPagination='false'
             :showTotal='true'
             :multiple='false'
             handler='hyDeptSettleApplyDetailsPageListHandler'
             :operator='operator'
             :autoLoad='false'
             :params='queryParam'
             :api='api.hyOrderDetailsReturn.list'>
      <span slot='drugType' slot-scope='text, record, index'>
           <a-tag color='#2db7f5' v-if='text=="ZY"'>自营</a-tag>
           <a-tag color='#FF0000' v-if='text=="ZS"'>招商</a-tag>
       </span>
      <span slot='sendType' slot-scope='text, record, index'>
           <a-tag color='#2db7f5' v-if='text==1'>现款</a-tag>
           <a-tag color='#FF0000' v-if='text==2'>预收款</a-tag>
           <a-tag color='#87d068' v-if='text==3'>资保金</a-tag>
           <a-tag color='purple' v-if='text==4'>全额资信</a-tag>
       </span>
    </f-table>
  </div>
</template>
<script>
import api from "../../../../js/api"


export default {
  name: "ApplyDetails",
  components: {  },
  props: {
    columns: {
      type: Array,
      default: []
    },
    invoiceApply: {
      type: Number,
      default: null
    },
    invoiceData: {
      type: Object,
      default: null
    }
  },
  data() {
    let me = this
    //操作按钮
    let operator = []
    return {
      api: Object.assign(api, this.api),
      multiple: false,
      deptId: "",
      //列表初始化查询参数
      queryParam: {
        fileName: "部门结算申请明细-",
        auth: 1,
        isFlp: 1
      },
      returnCustomBond: 0,
      selectIds: "",
      params1: {
        deptId: ""
      },
      settleType: null,
      dataSource: [],
      operator: operator
    }
  },
  computed: {
  
  },
  methods: {
    setData(data) {
      if (data && data.paymentId) {
        this.queryParam.paymentId = data.paymentId
        this.queryParam.settleType = data.settleType
        this.queryParam.processInstanceId = data.processInstanceId
        this.$refs["table"].refresh(false)
      }
    },
    //部门切换
    deptChange(value) {
      this.queryParam.deptId = value
      //this.openMultiple()
      this.$refs.saleMan.initData(this.queryParam)
      this.$refs.table.refresh(true, this.queryParam)
      this.$forceUpdate()
    },
    /**
     * 查询事件
     * @param searchParams
     */
    searchTable(searchParams) {
      this.queryParam = Object.assign(this.queryParam, searchParams)
      this.$refs.table.refresh(true, searchParams)
    },
    /**
     * 刷新列表
     */
    onLoad() {
      this.$refs["table"].refresh(false)
    }
  },
  created() {
  }
}
</script>